package com.example.dragandview.diyview;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.ViewGroup;

public class SeniorView extends ViewGroup {
    private final static int radius = 30 ; //圆的半径
    private final static int diameter = 2*radius ; //圆的半径
    private final static int rect_width = 700; //长方形的宽
    private final static int rect_height = 2*radius; //长方形的高=圆的直径
    private int startTop=50 , startLeft = 100 , endTop , endBottom;
    public SeniorView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {

    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = new Paint();
        paint.setColor(0xFFFF6600);
        paint.setStyle(Paint.Style.FILL);
        //绘制一条
//        canvas.drawArc(startLeft,startTop,diameter+startLeft,diameter+startTop,90,180,true,paint);
//        canvas.drawRect(startLeft+radius,0+startTop,startLeft+radius+rect_width,startTop+diameter,paint);
//        canvas.drawArc(startLeft+rect_width,startTop,diameter+rect_width+startLeft,diameter+startTop,270,180,true,paint);
//        for(int i = 1  ; i <= 10 ; i++){
//            startTop += diameter;
//            canvas.drawArc(startLeft,startTop,diameter+startLeft,diameter+startTop,90,180,true,paint);
//            canvas.drawRect(startLeft+radius,0+startTop,startLeft+radius+rect_width,startTop+diameter,paint);
//            canvas.drawArc(startLeft+rect_width,startTop,diameter+rect_width+startLeft,diameter+startTop,270,180,true,paint);
//        }


    }
}
